package job.work.domain.common;

import com.google.common.collect.ImmutableMap;
import job.work.domain.response.ResultCode;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

@Getter
public enum ResultEnum implements ResultCode {

    MENU_DELETED(false,50002,"菜单已删除"),
    STATUS_NON_NORMAL(false,50003,"菜单状态异常,无法删除"),
    MENU_HAS_EXIST(false,50004,"菜单已存在"),
    UPDATE_SUCCESS(true,50005,"修改成功"),
    ONE_MENU(false,50006,"当前菜单为一级菜单"),
    SYSTEM_ERROR(false,50007,"系统错误"),
    SAVE_SUCCESS(true,50008,"添加成功"),
    ROLE_HAS_EXIST(false,50009,"角色已存在"),
    ROLE_STATUS_NON_NORMAL(false,50012,"角色状态异常"),
    ROLE_HAS_USER(false,50013,"角色下有用户无法删除"),
    OLD_PWD_ERROR(false,50015,"原密码错误"),
    TWO_NO_EQUALS(false,50016,"两次输入的密码不一致"),
    NUM_NO_NULL(false,50017,"必须输入电话号码进行查询"),
    ACL_LIST_IS_NULL(false,50018,"权限集合为空"),
    USER_ACL_IS_NULL(false,50019,"当前用户没有任何权限"),
    FILE_UPLOAD_SUCCESS(true,50020,"文件上传成功"),
    FILE_UPLOAD_EOORO(false,50021,"文件上传失败"),
    USER_NO_ROLE(false,50022,"当前用户没有任何角色"),
    USER_NO_ACL(false,50023,"当前用户没有任何权限"),
    CONDITION_IS_NONE(false,50024,"请选择查询条件"),
    CONDITION_IS_REEOR_LEVE(false,50025,"请选择角色等级"),
    ENDTIME_IS_NULL(false,50026,"请选择开始时间"),
    DELETE_SUCCESS(true,50027,"删除成功"),
    MEETINGTYPE_ERROR(false,50028,"类型重复"),
    NAME_ERROR(false,50029,"名称重复"),
    NAME__PHONE_ERROR(false,50033,"电话号码重复"),
    CONFERENCEROOM_ERROR(false,50030,"创建会议出错,请重新创建会议!"),
    FILE_DOWNLOAD_EOORO(false,50031,"文件下载失败,请检查url!");



    //操作代码
    @ApiModelProperty(value = "操作是否成功", example = "true", required = true)
    boolean success;

    //操作代码
    @ApiModelProperty(value = "操作代码", example = "22001", required = true)
    int code;
    //提示信息
    @ApiModelProperty(value = "操作提示", example = "操作过于频繁！", required = true)
    String message;

     ResultEnum(boolean success, int code, String message){
        this.success = success;
        this.code = code;
        this.message = message;
    }
    private static final ImmutableMap<Integer, ResultEnum> CACHE;

    static {
        final ImmutableMap.Builder<Integer, ResultEnum> builder = ImmutableMap.builder();
        for (ResultEnum commonCode : values()) {
            builder.put(commonCode.code(), commonCode);
        }
        CACHE = builder.build();
    }

    @Override
    public boolean success() {
        return success;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String message() {
        return message;
    }
}
